<?php

class App_Helper_Menu_Container {
   
   private $_menus;
   private $_containerElement;
   private $_containerId;
   private $_dropDownElement;
   private $_dropDownId;
   
   
   public function __construct($containerElement='div', $containerId='menu-container', $dropDownElement='ul', $dropDownId='drop_down_menu') {
      $this->_containerElement = $containerElement;
      $this->_containerId = $containerId;
      $this->_dropDownElement = $dropDownElement;
      $this->_dropDownId = $dropDownId;
   }
   
   public function add($menu) {
      $this->_menus[] = $menu;
   }
   
   public function __toString() {
      $str = "<{$this->_containerElement}" . ($this->_containerId ? " id=\"$this->_containerId\"" : "") . ">\n";
      $str .= "<{$this->_dropDownElement}" . ($this->_dropDownId ? " id=\"$this->_dropDownId\"" : "") . ">\n";
      
      foreach($this->_menus as $menu) {
         $str .= $menu;
      }
      
      $str .= "</{$this->_dropDownElement}>\n";
      $str .= "</{$this->_containerElement}>\n";
      
      return $str;
   }
   
   
}